import React, { Component } from 'react';
import Taro from '@tarojs/taro';
import { View, Text, Button, Image } from '@tarojs/components';
import './index.scss'
import { queryFundObservationPoolList } from '@/services/api/fund';
import { parseDateFromStr } from '@/utils/fomatter';

interface FundDetailObservationPoolProps {
  className?: string;
  detailData: any
}


class FundDetailObservationPool extends Component<FundDetailObservationPoolProps, any> {

  config = {
    navigationBarTitleText: ''
  }

  state = {
    dataList: [],

  }

  componentWillMount() {
  }



  componentDidMount() { }
  componentWillReceiveProps(nextProps, nextContext) { }
  componentWillUnmount() { }

  render() {
    const { className, detailData } = this.props
    return (
      <>
        {
          detailData && detailData.observationPoolReports && detailData.observationPoolReports.length > 0 ?
            <View className={`fund-detail-observation-pool ${className}`}>
              <Text className='title'>相关观察池报告</Text>
              <View className='context'>{
                detailData.observationPoolReports.map((item, index) => {
                  return <View className='context-item'>
                    <Text className='context-item-title' space='nbsp' decode>{`${parseDateFromStr(item['created'], 'YYYY年MM月')}&nbsp;|&nbsp;${item['reportName']}`}</Text>
                    <Text className='context-item-time' space='nbsp' decode>{`净值日期&nbsp;${parseDateFromStr(item['netDate'], 'MM-DD')}`}</Text>
                  </View>
                })

              }
              </View>

              {
                 detailData && detailData.observationPoolReports && detailData.observationPoolReports.length > 2 ? <View className='bottom-more'>
                  <Text>查看更多</Text>
                  <Image src={require('@/assets/icons/arrow-right3.png')} ></Image>
                </View> : null
              }


            </View>
            : null
        }
      </>

    );
  }
}
export default FundDetailObservationPool;